#include <iostream>
#include <string.h>
#include "Time.hpp"
#include "Fifo.hpp"
#include "ShareMemory.hpp"

int main()
{
    std::cout << "time: " << GetCurrTime() << std::endl;
    shm.CreateShm();
    shm.AttachShm();

    //shm.ShmMeta();

    gpipe.OpenPipeForRead();
    sleep(10);
    // 这里进行IPC
    struct data *image = (struct data *)shm.GetAddr();
    // std::cout << "server 虚拟地址: " << strinfo << std::endl;
    //printf("server 虚拟地址: %p\n", strinfo);

    while (true)
    {
        gpipe.Wait();

        printf("status: %s\n", image->status);
        printf("lasttime: %s\n", image->lasttime);
        printf("image: %s\n", image->image);
        strcpy(image->status, "过期");
    }

    // sleep(10);
    shm.DetachShm();
    shm.DeleteShm();
    return 0;
}

